package com.tanhua.dubbo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.domain.db.SoulQuestion;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 胡少东
 * @create 2021/8/6 20:50
 */
public interface SoulQuestionMapper extends BaseMapper<SoulQuestion> {

    List<SoulQuestion> questSoulQuestionsByQuestionId(Long questionId);

    /**
     * 根据questionId 和 optionId 来查询分数
     * @param questionId
     * @param optionId
     * @return
     */
    @Select("select op.fraction from tb_bquestion tb INNER JOIN tb_option op \n" +
            "on tb.id = op.question_id where tb.id = #{questionId} and op.id=#{optionId}")
    Integer totalScoreByQuestionIdAndOptionId(@Param("questionId") Long questionId,@Param("optionId") Long optionId);
}
